import { getClassAll, getInfo, getTagAll } from "@/api";
import Vuex, { Store } from "vuex";
import Vue from "vue";


Vue.use(Vuex)
export const store = new Store({
    state:()=>{
      return {
        info:{},
        tags:[],
        classlist:[]
      }
    },
    mutations:{
      setd(state,data){
        state.info=data;
      },
      setTags(state,data){
        state.tags=data;
      },
      setclasslist(state,data){
        state.classlist=data;
      }
    },
  actions:{
      async getd({commit}){
       let data =  await getInfo()
        commit("setd",data)
      },
    async getTags({commit}){
        let data = await getTagAll()
        commit("setTags",data)
    },
    async getClasslist({commit}){
      let data = await getClassAll()
      commit("setclasslist",data)
    }
  }
})